/*
 * Copyright (c) 2020, 2023, 3044483124@qq.com All rights reserved.
 *
 */
package itcast;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
/**
 * <p>Project: JavaStudy - LocalTimeDemo
 * <p>Powered by jiangbo On 2023-02-01
 * 21:45:13
 * <p>Created by IntelliJ IDEA
 *
 * @author jiangbo [3044483124@qq.com]
 * @version 1.0
 * @since 8/17
 */
public class LocalTimeDemo {
    public static void main(String[] args) {
//LocalTime 实例化
        var t1 = LocalTime.now();
        var t2 = LocalTime.of(14,30,20);
        var t3 = LocalTime.parse("15:25:35", DateTimeFormatter.ofPattern("HH:mm:ss"));
//简单输出
        System.out.println(t1);
        System.out.printf("%tT%n",t1);
        System.out.println(t2);
        System.out.println(t3);
//格式化输出
        DateTimeFormatter df = DateTimeFormatter.ofPattern("HH时mm分 ss秒");
                System.out.println(df.format(t1));
        System.out.println(df.format(t2));
        System.out.println(df.format(t3));
        System.out.println(t1.plusSeconds(1000));
        System.out.println(t1.plusSeconds(1000).format(DateTimeFormatter.ofPattern("HH:mm:ss")));
    }
}


